/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author lcarou
 */
@Entity
@Table(name = "arsARTICULO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ArsARTICULO.findAll", query = "SELECT a FROM ArsARTICULO a"),
    @NamedQuery(name = "ArsARTICULO.findByCodigo", query = "SELECT a FROM ArsARTICULO a WHERE a.codigo = :codigo"),
    @NamedQuery(name = "ArsARTICULO.findByDescripcion", query = "SELECT a FROM ArsARTICULO a WHERE a.descripcion = :descripcion"),
    @NamedQuery(name = "ArsARTICULO.findByDescripcionResumida", query = "SELECT a FROM ArsARTICULO a WHERE a.descripcionResumida = :descripcionResumida"),
    @NamedQuery(name = "ArsARTICULO.findByAlias", query = "SELECT a FROM ArsARTICULO a WHERE a.alias = :alias"),
    @NamedQuery(name = "ArsARTICULO.findByCodigoBarras", query = "SELECT a FROM ArsARTICULO a WHERE a.codigoBarras = :codigoBarras"),
    @NamedQuery(name = "ArsARTICULO.findBySeleccion", query = "SELECT a FROM ArsARTICULO a WHERE a.seleccion = :seleccion"),
    @NamedQuery(name = "ArsARTICULO.findByCategoria", query = "SELECT a FROM ArsARTICULO a WHERE a.categoria = :categoria"),
    @NamedQuery(name = "ArsARTICULO.findByTipo", query = "SELECT a FROM ArsARTICULO a WHERE a.tipo = :tipo"),
    @NamedQuery(name = "ArsARTICULO.findByLlevaStock", query = "SELECT a FROM ArsARTICULO a WHERE a.llevaStock = :llevaStock"),
    @NamedQuery(name = "ArsARTICULO.findByPorcentajeTolerancia", query = "SELECT a FROM ArsARTICULO a WHERE a.porcentajeTolerancia = :porcentajeTolerancia"),
    @NamedQuery(name = "ArsARTICULO.findByGenerico", query = "SELECT a FROM ArsARTICULO a WHERE a.generico = :generico"),
    @NamedQuery(name = "ArsARTICULO.findByActivo", query = "SELECT a FROM ArsARTICULO a WHERE a.activo = :activo")})
public class ArsARTICULO implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 24)
    @Column(name = "Codigo")
    private String codigo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "Descripcion")
    private String descripcion;
    @Size(max = 100)
    @Column(name = "DescripcionResumida")
    private String descripcionResumida;
    @Size(max = 20)
    @Column(name = "Alias")
    private String alias;
    @Size(max = 20)
    @Column(name = "CodigoBarras")
    private String codigoBarras;
    @Size(max = 32)
    @Column(name = "Seleccion")
    private String seleccion;
    @Size(max = 32)
    @Column(name = "Categoria")
    private String categoria;
    @Size(max = 32)
    @Column(name = "Tipo")
    private String tipo;
    @Column(name = "LlevaStock")
    private Boolean llevaStock;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "PorcentajeTolerancia")
    private BigDecimal porcentajeTolerancia;
    @Column(name = "Generico")
    private Boolean generico;
    @Column(name = "Activo")
    private Boolean activo;
    @JoinTable(name = "lisLISTAA", joinColumns = {
        @JoinColumn(name = "Articulo", referencedColumnName = "Codigo")}, inverseJoinColumns = {
        @JoinColumn(name = "Lista", referencedColumnName = "Codigo")})
    @ManyToMany
    private Collection<LisLISTA> lisLISTACollection;
    @JoinColumns({
        @JoinColumn(name = "Familia", referencedColumnName = "Familia", insertable=false, updatable=false),
        @JoinColumn(name = "Subfamilia", referencedColumnName = "Codigo")})
    @ManyToOne(optional = false)
    private ArsSUBFAMILIA arsSUBFAMILIA;
    @JoinColumn(name = "PerfilVentas", referencedColumnName = "Codigo")
    @ManyToOne
    private ArsPERFILVENTAS perfilVentas;
    @JoinColumn(name = "PerfilImpositivo", referencedColumnName = "Codigo")
    @ManyToOne(optional = false)
    private ArsPERFILIMPOSITIVO perfilImpositivo;
    @JoinColumn(name = "PerfilContable", referencedColumnName = "Codigo")
    @ManyToOne(optional = false)
    private ArsPERFILCONTABLE perfilContable;
    @JoinColumn(name = "Familia", referencedColumnName = "Codigo")
    @ManyToOne(optional = false)
    private ArsFAMILIA familia;

    public ArsARTICULO() {
    }

    public ArsARTICULO(String codigo) {
        this.codigo = codigo;
    }

    public ArsARTICULO(String codigo, String descripcion) {
        this.codigo = codigo;
        this.descripcion = descripcion;
    }

    public String getCodigo() {
        return codigo;
    }

    public void setCodigo(String codigo) {
        this.codigo = codigo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getDescripcionResumida() {
        return descripcionResumida;
    }

    public void setDescripcionResumida(String descripcionResumida) {
        this.descripcionResumida = descripcionResumida;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    public String getCodigoBarras() {
        return codigoBarras;
    }

    public void setCodigoBarras(String codigoBarras) {
        this.codigoBarras = codigoBarras;
    }

    public String getSeleccion() {
        return seleccion;
    }

    public void setSeleccion(String seleccion) {
        this.seleccion = seleccion;
    }

    public String getCategoria() {
        return categoria;
    }

    public void setCategoria(String categoria) {
        this.categoria = categoria;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public Boolean getLlevaStock() {
        return llevaStock;
    }

    public void setLlevaStock(Boolean llevaStock) {
        this.llevaStock = llevaStock;
    }

    public BigDecimal getPorcentajeTolerancia() {
        return porcentajeTolerancia;
    }

    public void setPorcentajeTolerancia(BigDecimal porcentajeTolerancia) {
        this.porcentajeTolerancia = porcentajeTolerancia;
    }

    public Boolean getGenerico() {
        return generico;
    }

    public void setGenerico(Boolean generico) {
        this.generico = generico;
    }

    public Boolean getActivo() {
        return activo;
    }

    public void setActivo(Boolean activo) {
        this.activo = activo;
    }

    @XmlTransient
    public Collection<LisLISTA> getLisLISTACollection() {
        return lisLISTACollection;
    }

    public void setLisLISTACollection(Collection<LisLISTA> lisLISTACollection) {
        this.lisLISTACollection = lisLISTACollection;
    }

    public ArsSUBFAMILIA getArsSUBFAMILIA() {
        return arsSUBFAMILIA;
    }

    public void setArsSUBFAMILIA(ArsSUBFAMILIA arsSUBFAMILIA) {
        this.arsSUBFAMILIA = arsSUBFAMILIA;
    }

    public ArsPERFILVENTAS getPerfilVentas() {
        return perfilVentas;
    }

    public void setPerfilVentas(ArsPERFILVENTAS perfilVentas) {
        this.perfilVentas = perfilVentas;
    }

    public ArsPERFILIMPOSITIVO getPerfilImpositivo() {
        return perfilImpositivo;
    }

    public void setPerfilImpositivo(ArsPERFILIMPOSITIVO perfilImpositivo) {
        this.perfilImpositivo = perfilImpositivo;
    }

    public ArsPERFILCONTABLE getPerfilContable() {
        return perfilContable;
    }

    public void setPerfilContable(ArsPERFILCONTABLE perfilContable) {
        this.perfilContable = perfilContable;
    }

    public ArsFAMILIA getFamilia() {
        return familia;
    }

    public void setFamilia(ArsFAMILIA familia) {
        this.familia = familia;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigo != null ? codigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ArsARTICULO)) {
            return false;
        }
        ArsARTICULO other = (ArsARTICULO) object;
        if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.ArsARTICULO[ codigo=" + codigo + " ]";
    }
    
}
